﻿using Avalon.Core.Data;
using Avalon.Core.MVC.Actions;
using Avalon.Core.MVC.Attributes;
using Avalon.Core.MVC.StateBags;

namespace Avalon.Core.MVC.Pipelines {
    [Pipeline("GetNew")]
    public class GetNewPipeline<TModel> : BasePipeline where TModel : class, IEntity, new() {
        public GetNewPipeline() {
            this.PipelineActions.Add(
                new AnonymousAction<TModel>(0, s => s.Result = new TModel()));
        }

        public override void InitializeStateBag() {
            this.StateBag = new StateBag();
        }
    }
}
